package com.mitaotao._1_语法._3_分支._1_数值交换;

public class _04_数值交换_多个 {
    public static void main(String[] args) {
        int num1 = 34;
        int num2 = 56;
        int num3 = 22;
        int temp = 0;//临时变量
        System.out.println("数值交换之前的num1为："+num1);
        System.out.println("数值交换之前的num2为："+num2);
        System.out.println("数值交换之前的num3为："+num3);

        if(num1<num2){
            temp = num1;
            num1 = num2;
            num2 = temp;
            //num1=56,num2=34,num3=22,num4=34
        }
        if(num1<num3){
            temp = num1;
            num1 = num3;
            num3 = temp;
        }
        if(num2<num3){
            temp = num3;
            num3 = num2;
            num2 = temp;
        }
        System.out.println("数值交换之后num1为："+num1);
        System.out.println("数值交换之后num2为："+num2);
        System.out.println("数值交换之后num3为："+num3);
    }
}
